//
// Created by Suzhen on 2017/2/24.
//

#include "AbstractAsyncStream.h"

USING_ORION_V2

AbstractAsyncStream::~AbstractAsyncStream() {
}

AbstractAsyncStream::AbstractAsyncStream(const IOBehavior &ioBehavior)
        : eventGenerator_(nullptr),
          ioBehavior_(ioBehavior) {
}


void AbstractAsyncStream::attach(AsyncEventGenerator *gen) {
    SYS_FAULT(!isAttached())
    << "当前 Stream 已经附加到一个已存在的 AsyncEventGenerator 上";
    eventGenerator_ = gen;
}

bool AbstractAsyncStream::isAttached() {
    return eventGenerator_ != nullptr;
}

